import Foundation

struct FATrackConfigs: Codable {
    
    // 平台申请的appid
    var appid: String = ""
    // 渠道名称
    var channel: String = "appstore"
    // 开启自动上报
    var enabledAutoTrack: Bool = true
    // 日志上报是否加密。用于debug情况可以抓包调试
    var needEncrypt: Bool = true
    // 是否开启debug调试模式
    var openDebugMode: Bool = false
    
    // 转为对象
    static func toObject(with data: Data?) -> FATrackConfigs? {
        do {
            guard let data = data else { return nil }
            let object = try JSONDecoder().decode(self, from: data)
            return object
        } catch let error {
            print("codable is found error \(error)")
            return nil
        }
    }
}
